<template>
    <div>
        <Drawer width="640" v-model="show" @on-close="$emit('closeM')">
            <div class="demo-drawer-profile">
                <Row>
                    <Col span="24">
                      比对是否冷链进出口数据: {{thanObject.is_ll}}
                    </Col>
                    <Col span="24">
                      比对装货卸货地是否为高风险地区: {{thanObject.is_zhd}}
                      <Table v-if="thanObject.is_zhd === '是'" border :columns="columns1" :data="thanObject.is_zhd_json"></Table>
                    </Col>
                    <Col span="24">
                      比对核酸检测: {{thanObject.is_hs}}
                      <Table v-if="thanObject.is_hs === '是'" border :columns="columns2" :data="thanObject.is_hs_json"></Table>
                    </Col>
                    <Col span="24">
                      比对疫苗接种: {{thanObject.is_ym}}
                      <Table v-if="thanObject.is_ym === '是'" border :columns="columns3" :data="thanObject.is_ym_json"></Table>
                    </Col>
                    <Col span="24">
                      比对市民码: {{thanObject.is_smm}}
                    </Col>
                    <Col span="24">
                      比对社区电子围栏: {{thanObject.is_dzwl}}
                    </Col>
                    <Col span="24">
                      比对14天行程: {{thanObject.is_xc}}
                      <Table v-if="thanObject.is_xc === '是'" border :columns="columns4" :data="thanObject.is_xc_json"></Table>
                    </Col>
                </Row>
                <Divider />
            </div>
        </Drawer>
    </div>
</template>
<script>
import {
  getBdResult
} from '../../api/system/record'
export default {
  props: {
    showModal: {
      type: Boolean,
      default: false
    },
    code: {
      type: String,
      default: ''
    }
  },
  watch: {
    showModal: function (n) { this._data.show = n },
    code: function (n) {
      console.log(n)
      this.getBdResult(n)
    }
  },
  data () {
    return {
      show: false,
      thanObject: {},
      columns1: [
        {
          title: '地区',
          key: 'city'
        },
        {
          title: '是否为高风险地区',
          key: 'fxdj'
        }
      ],
      columns2: [
        {
          title: '名字',
          key: 'NAME'
        },
        {
          title: '身份证',
          key: 'SFZH'
        },
        {
          title: '检测地点',
          key: 'JCJGOU'
        },
        {
          title: '检测结果',
          key: 'JCJG'
        },
        {
          title: '检测时间',
          key: 'HSJCSJ'
        }
      ],
      columns3: [
        {
          title: '名字',
          key: 'SZZXM'
        },
        {
          title: '身份证',
          key: 'SFZJHM'
        },
        {
          title: '电话',
          key: 'DHHM'
        },
        {
          title: '接种地点',
          key: 'JZDW'
        },
        {
          title: '接种厂家',
          key: 'YMSCQY'
        },
        {
          title: '接种时间',
          key: 'YMJZSJ'
        }
      ],
      columns4: [
        {
          title: '行程',
          key: 'tids'
        },
        {
          title: '证件号码',
          key: 'zjhm'
        }
      ]
    }
  },
  mounted () {

  },
  methods: {
    getBdResult (register_code) {
      this.$nextTick(() => {
        getBdResult({ register_code }).then(res => {
          console.log(res, 'register_code')
          if (res.data.data.is_dzwl_json)res.data.data.is_dzwl_json = JSON.parse(res.data.data.is_dzwl_json)
          if (res.data.data.is_smm_json)res.data.data.is_smm_json = JSON.parse(res.data.data.is_smm_json)
          if (res.data.data.is_ym_json)res.data.data.is_ym_json = JSON.parse(res.data.data.is_ym_json)
          if (res.data.data.is_xc_json)res.data.data.is_xc_json = JSON.parse(res.data.data.is_xc_json)
          if (res.data.data.is_hs_json)res.data.data.is_hs_json = JSON.parse(res.data.data.is_hs_json)
          if (res.data.data.is_zhd_json)res.data.data.is_zhd_json = JSON.parse(res.data.data.is_zhd_json)
          this.thanObject = res.data.data
        })
      })
    }
  }
}
</script>
<style>
    .demo-drawer-profile{
        font-size: 14px;
    }
    .demo-drawer-profile .ivu-col{
        margin-bottom: 12px;
    }
    .img_list{
    margin: 20px 0.853rem;
    display: flex;
    }
  .img_list img{
      width: 120px;
      height: 120px;
      margin-right: 20px;
    }
    .demo-drawer-profile .ivu-col{
      margin-top: 20px!important;
    }
</style>
